package com.designpattern.singleton;

/**
 * 懒汉式单例模式
 */
public class HungrysingletonTest {

    public static void main(String[] args) {
        Hungrysingleton hungrysingleton = Hungrysingleton.getHungrysingleton();
        Hungrysingleton hungrysingleton1 = Hungrysingleton.getHungrysingleton();
        System.out.println(hungrysingleton);
        System.out.println(hungrysingleton1);
    }


}

class Hungrysingleton{
    private static Hungrysingleton hungrysingleton=new Hungrysingleton();

    private Hungrysingleton(){

    }

    public static Hungrysingleton getHungrysingleton(){
        return hungrysingleton;
    }
}
